<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>七夕活动-登录</title>
    <script src="../Js/jquery-3.5.1.min.js" type="text/javascript"></script>
    <script src="../Js/Config.js" type="text/javascript"></script>
    <script src="../Js/Common.js" type="text/javascript"></script>

    <!--    页面样式    -->
    <link href="../Css/all.css" rel="stylesheet" type="text/css" />

    <!--    弹窗插件    -->
    <script src="../Js/Msg/jquery.growl.js" type="text/javascript"></script>
    <link href="../Js/Msg/jquery.growl.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="register-box">
        <div class="title">登录</div>
        <form name="registerBody" method="post">
            <input name="username" placeholder="用户名">
            <br>
            <input name="password" placeholder="登录密码"><br>

            <input type="button" name="register" value="提交"><br>
        </form>
    </div>
    <div style="margin-top: 50px">
        <a href="register.html">去注册>>>>>>></a>
    </div>
</body>
    <script>
        $(document).ready(function () {
            $("input[name=register]").click(function (e) {
                var formData = $("form[name=registerBody]").serializeArray()
                requestHost('user/login', formData, 'POST').then(function (res) {
                    saveToken(res.data.token)
                    $.growl.notice({
                        title: "成功",
                        message: res.msg
                    });
                    setTimeout(function () {
                        window.location.href = 'list.html';
                    }, 1000)
                })
            });
        })
    </script>
</html>